package com.xiaoze.source;

import com.xiaoze.entity.SensorReading;
import org.apache.flink.streaming.api.datastream.DataStreamSource;
import org.apache.flink.streaming.api.environment.StreamExecutionEnvironment;

/**
 * 读取自定义数据源
 *
 * @author xiaoze
 * @date 2021/12/27
 */
public class SourceUdf {

    public static void main(String[] args) throws Exception {

        StreamExecutionEnvironment env = StreamExecutionEnvironment.getExecutionEnvironment();

        env.setParallelism(1);

        DataStreamSource<SensorReading> dataStream = env.addSource(new MySensorSource());

        dataStream.print();

        env.execute();

    }

}
